//package com.tarena.lbs.user.dao.repository.impl;
//
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.tarena.lbs.user.dao.mapper.CaptchaMapper;
//import com.tarena.lbs.user.dao.repository.CaptchaRepository;
//import com.tarena.lbs.user.pojo.po.CaptchaPO;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Repository;
//
//import java.time.LocalDateTime;
//import java.util.UUID;
//
//@Repository
//public class CaptchaRepositoryImpl implements CaptchaRepository {
//
//    @Autowired
//    private CaptchaMapper captchaMapper;
//
//    @Override
//    public CaptchaPO save(CaptchaPO po) {
//        captchaMapper.insert(po);
//        return po;
//    }
//
//    @Override
//    public CaptchaPO getByKey(String captchaKey) {
//        QueryWrapper<CaptchaPO> query = new QueryWrapper<>();
//        query.eq("captcha_key", captchaKey)
//                .gt("expire_time", LocalDateTime.now()); // 只查未过期的
//        return captchaMapper.selectOne(query);
//    }
//
//    @Override
//    public void deleteExpired() {
//        QueryWrapper<CaptchaPO> query = new QueryWrapper<>();
//        query.lt("expire_time", LocalDateTime.now());
//        captchaMapper.delete(query);
//    }
//}